<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model common\models\Activity */

$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => '活动列表', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="activity-view">

    <h1><?= Html::encode($this->title) ?></h1>



    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
            'name',
            ['attribute'=>'banner','format'=>'raw','value'=>function($model){
                return Html::img($model->banner,['style'=>'height:30px;']);
            }],
            ['attribute'=>'other_entry','format'=>'raw','value'=>function($model){
                return Html::img($model->other_entry,['style'=>'height:30px;']);
            }],
            'other_entry_url',
            'store_id',
            ['attribute'=>'activity_catalog','value'=>'团购'],
            'peoples',
            ['attribute'=>'start_user_type','value'=>function($model){
                switch($model->start_user_type){
                    case 0:
                        return "全部";
                        break;
                    case 1:
                        return "新用户";
                        break;
                    case 2:
                        return "老用户";
                        break;
                }
            }],
            ['attribute'=>'join_user_type','value'=>function($model){
                switch($model->join_user_type){
                    case 0:
                        return "全部";
                        break;
                    case 1:
                        return "新用户";
                        break;
                    case 2:
                        return "老用户";
                        break;
                }
            }],

            ['attribute'=>'start_time','value'=>function($model){
                return date("Y-m-d H:i:s",strtotime($model->start_time));
            }],
            ['attribute'=>'end_time','value'=>function($model){
                return date("Y-m-d H:i:s",strtotime($model->end_time));
            }],

            'goods:ntext',
            'description:ntext',
            ['attribute'=>'status','value'=>function($model){
                return $model->status?"上架":"下架";
            }],
            'share_title',
            ['attribute'=>'share_img','format'=>'raw','value'=>function($model){
                return Html::img($model->share_img,['style'=>'height:30px;']);
            }],
            'share_remark',
            'share_url'
        ],
    ]) ?>

</div>
